<div class="layui-fluid" id="VIEW-list-table" lay-title="原材料用量">
    <div class="layui-row layui-col-space10">
        <div class="layui-col-md12">
            <!-- <div class="layui-card">
                <div class="layui-card-header" lig-lang="label-searchTitle">筛选数据</div>
                <div class="layui-card-body">
                    <form class="layui-form" lay-filter="lig-ingredient-report-searchform">
                        <div class="layui-row">
                            <div class="layui-inline">
                                <label class="layui-form-label" lig-lang="device-name">名称</label>
                                <div class="layui-inline">
                                    <input type="text" class="layui-input" name="name" />
                                </div>
                            </div>
                            <div class="layui-inline">
                                <div class="layui-row layui-col-space10">
                                    <div class="layui-col-xs6">
                                        <div class="layui-btn layui-btn-sm layui-btn-fluid" lay-filter="lig-ingredient-report-search" lig-lang="btn-search">查询</div>
                                    </div>
                                    <div class="layui-col-xs6">
                                        <button type="reset" class="layui-btn layui-btn-sm layui-btn-primary" lig-lang="btn-reset">重置</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div> -->
            <div class="layui-card">
                <div class="layui-card-body nepadmin-table-full">
                    <div class="layui-btn-container nepadmin-pad-t10 nepadmin-pad-l10">
                        <!-- <div class="layui-btn layui-btn-sm" lay-filter="lig-ingredient-report-add" lig-lang="btn-adddevice">添加固件</div> -->
                    </div>
                    <table lay-filter="lig-ingredient-report-table"></table>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/html" id="tpl-row-toolBar">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="lig-modify" lig-lang="btn-modify">修改</a>
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="lig-delete" lig-lang="btn-delete">删除</a>
</script>
<script type="text/html" id="tpl-ingredient-report-add">
    <form class="layui-form" style="padding: 20px 20px 0 0;" lay-filter="lig-saveForm">
        <div class="layui-form-item">
            <label class="layui-form-label ligui-form-item-required" lig-lang="device-name">名称</label>
            <div class="layui-input-block">
                <input type="text" name="name" autocomplete="off" lay-verify="required" class="layui-input"
                        value=''>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label ligui-form-item-required" lig-lang="device-version">版本</label>
            <div class="layui-input-block">
                <input type="text" name="version" autocomplete="off" lay-verify="required" class="layui-input"
                        value=''>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" lig-lang="device-downloadAddress">下载地址</label>
            <div class="layui-input-block">
                <input type="text" name="downloadAddress" autocomplete="off" class="layui-input"
                        value=''>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" lig-lang="device-updateTime">更新时间</label>
            <div class="layui-input-block">
                <input type="text" name="updateTime" autocomplete="off" class="layui-input"
                        value=''>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" lig-lang="device-content">描述</label>
            <div class="layui-input-block">
                <input type="text" name="content" autocomplete="off" class="layui-input"
                        value=''>
            </div>
        </div>
    </form>
</script>
<script type="text/html" id="tpl-ingredient-report-modify">
    <form class="layui-form" style="padding: 20px 20px 0 0;" lay-filter="lig-saveForm">
        <input type="hidden" name="deviceId" value="{{d.deviceId}}"/>
        <div class="layui-form-item">
            <label class="layui-form-label ligui-form-item-required" lig-lang="device-name">名称</label>
            <div class="layui-input-block">
                <input type="text" name="name" autocomplete="off" lay-verify="required" class="layui-input"
                        value='{{d.name}}'>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" lig-lang="device-version">版本</label>
            <div class="layui-input-block">
                <input type="text" autocomplete="off" class="layui-input" disabled
                        value='{{d.version}}'>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" lig-lang="device-downloadAddress">下载地址</label>
            <div class="layui-input-block">
                <input type="text" name="downloadAddress" autocomplete="off" class="layui-input"
                        value='{{d.downloadAddress}}'>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" lig-lang="device-updateTime">更新时间</label>
            <div class="layui-input-block">
                <input type="text" name="updateTime" autocomplete="off" class="layui-input"
                        value='{{d.updateTime}}'>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" lig-lang="device-content">描述</label>
            <div class="layui-input-block">
                <input type="text" name="content" autocomplete="off" class="layui-input"
                        value='{{d.content}}'>
            </div>
        </div>
    </form>
</script>
<script>
    layui.use(['laydate', 'admin', 'table', 'form', 'dropdown', 'laytpl', 'jquery','lig2'], function (laydate, admin, table, form, dropdown, laytpl, $, lig) {
        //lig.filter();

        form.render();

        

        lig.table({
            elem: '[lay-filter="lig-ingredient-report-table"]',
            url: 'milktea/ingredient/collect/report',
            cols: [[
                // { title: '<span lig-lang="label-opt">操作</span>', toolbar: '#tpl-row-toolBar', align: 'left', width: 120, fixed: 'left'},
                { title: '<span>原料名称</span>', field: 'name', minWidth: 120 },
                { title: '<span>泵号</span>', field: 'pumpName', minWidth: 60 },
                { title: '<span>使用量（g）</span>', field: 'amountUsed', minWidth: 120 },

            ]],
            page: false,
            done: function () {
                lig.filter($('[lay-filter="lig-ingredient-report-table"]'));
            }
        },{
            mode:'dialog',
            entity: 'device',
            primaryField: 'id',
            addContent: $('#tpl-ingredient-report-add').html(),
            addUrl: 'milktea/device/add',
            addTitle: '<span lig-lang="device-adddevice">添加固件</span>',
            area: ['50%', 'auto'],
            onAddOpened: function() {
                var _form = '[lay-filter="lig-saveForm"]';
                laydate.render({
                    elem: _form + ' input[name="updateTime"]'
                });
            },

            modifyContent: $('#tpl-ingredient-report-modify').html(),
            modifyUrl: 'milktea/device/modify',
            modifyTitle: '<span lig-lang="device-modifydevice">修改固件</span>',
            area: ['50%', 'auto'],
            onModifyOpened: function() {
                var _form = '[lay-filter="lig-saveForm"]';
                laydate.render({
                    elem: _form + ' input[name="updateTime"]'
                });
            },

            removeUrl: 'milktea/device/remove',
            getUrl: 'milktea/device/{id}'
        });

    })
</script>